<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
 <script type="text/javascript" src="jquery-1.8.3.js"></script> 
 <script type="text/javascript">
	function check() {
		var sname=$("#sname").val();
		if (sname==null ||sname=="") {
			alert("用户名不能为空");
			return;
		}else {
			$.post("name.action",
					{"sname":sname},
					function(data){
						if (data.toString()=="自己人！") {
							$('#usermsg').css("color","green");
						}else{
							$('#usermsg').css("color","red");
						}
						$("#usermsg").html(data);
					});
		}
	}
</script>

</head>
<body>
																<!--get post 方法 <!---->
	<form action="${pageContext.request.contextPath }/login.action" >
		用户<input type="text" name="sname" id="sname"  onblur="check() "><div id="usermsg"></div>
		密码<input type="password" name="password"><br>
		<input type="submit" value="登录">
		<input type="reset" value="重置">
	</form>
</body>
</html>